import socket , time
host , port = '127.0.0.1' , 6565
socket_client = socket.socket()
socket_client.connect((host,port))
socket_client.send('我是客户端，很高兴与你连接!'.encode('utf-8'))
while True:
    msg = f"<客户端自动回复>{time.time()}".encode('utf-8')
    data = socket_client.recv(1024).decode('utf-8')
    print(f"收到服务端信息:{data}")
    if data == 'exit':
        msg = '收到来自服务端的<退出>指令'.encode('utf-8')
        socket_client.send(msg)
        break
    socket_client.send(msg)
socket_client.send('再见!'.encode('utf-8'))
socket_client.close()